/* (function(){
  //获取form元素
  const form1 = document.querySelector('.rg_center .rg_form form')
  //绑定事件
    form1.addEventListener('submit',function(e){
      e.preventDefault()
    //移除默认刷新
    const data = $(this).serialize()

    $.ajax({
      type:'POST',
      url:'http://124.223.14.236:3001/api/user/reg',
      data:data,
      success:function(res){
        console.log(res)
        if(!res.success) return alert('注册失败：'+ res.msg)
        alert('注册成功')
        location.href='../loginBaseCode/login.html'
      }
    })
    
  })

})() */

$(function (){
  $('#Form').on('submit',function(e){
  e.preventDefault()
  const data = $(this).serialize()
  $.ajax({
    type:'post',
    url:'http://124.223.14.236:3001/api/user/reg',
    data:data,
    success:function(res){
      console.log(res);
      if(!res.success) return alert('注册失败'+res.msg)
      alert('注册成功')
      location.href='../loginBaseCode/login.html'
    }
  })
  })
})
